﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ArithmeticExpressionCalculator
{
    public class DoubleSideExpression
    {
        protected string CalculateOperationByPosition(string expr, int position)
        {
            Operands operands = new Operands(expr, position);
            int left_boundary, right_boundary;
            AtomOperation atom_operation = new AtomOperation(operands.GetLeftOperand(out left_boundary), operands.GetRightOperand(out right_boundary), expr[position]);
            double local_result = atom_operation.Execute();
            CorrectValueInsert cvi = new CorrectValueInsert(expr, local_result);
            expr = cvi.Exchange(left_boundary, right_boundary);
            return expr;
        }
    }
}
